package com.mqzhang.demo.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mqzhang.demo.entity.TbTest;
import com.mqzhang.demo.service.DemoService;

/**
 * 控制层
 * 
 * @author mq.zhang
 * @version V1.0 2016年9月9日
 */
@Controller
@RequestMapping(value = "/demo")
public class JsonController {
    @Autowired
    private DemoService service;

    @RequestMapping(value = "/hellojson")
    @ResponseBody
    public List<TbTest> query(@RequestParam(name = "pageNum", required = false) String pageNum, HttpServletRequest request,
            HttpServletResponse response, Model model) {
        return service.selectEntry(pageNum);
    }
}
